<?php

/**
 * StaffProfile form base class.
 *
 * @method StaffProfile getObject() Returns the current form's model object
 *
 * @package    erp-dnict
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseStaffProfileForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'job_specialization'  => new sfWidgetFormInputText(),
      'gov_organization_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GovOrganization'), 'add_empty' => false)),
      'contract_type'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contract'), 'add_empty' => false)),
      'minority_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Minority'), 'add_empty' => false)),
      'religion_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Religion'), 'add_empty' => false)),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'job_specialization'  => new sfValidatorString(array('max_length' => 255)),
      'gov_organization_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GovOrganization'))),
      'contract_type'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contract'))),
      'minority_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Minority'))),
      'religion_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Religion'))),
      'created_at'          => new sfValidatorDateTime(),
      'updated_at'          => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('staff_profile[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'StaffProfile';
  }

}
